package com.ynny.chapter06;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/demo10")
public class Demo10Servlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest request,
                           HttpServletResponse response) throws ServletException, IOException {

        //从作用域中 获取数据

        System.out.println(request.getAttribute("msg"));


        //从会话作用域 获取数据
        System.out.println(request.getSession().getAttribute("msg2"));

        //从应用作用域 获取数据
        System.out.println(getServletContext().getAttribute("msg3"));
    }
}
